<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2022-10-06
 * Time: 22:10
 */

namespace App\controller\work;


use App\server\work\FactoryWork;
use support\Request;
use think\facade\Db;

class Index
{
    public function index (Request $request)
    {

        $app=FactoryWork::app(4);
        $user = $app->oauth->detailed()->userFromCode($request->get('code'));
        return json([$user->getRaw()]);
    }
    public function click(Request $request)
    {
        $id=$request->get('id');
        Db::connect('order')->table('staff')->where('staff_id',$id)->inc('open')->update();
        return redirect('https://work.weixin.qq.com/');
    }
}